home *** CD-ROM | disk | FTP | other *** search
/ HamCall (April 1991) / HAMCALL CD-ROM (Buckmaster)(April 1991).BIN / prgming / ctutor / twoway.c < prev    next >
Text File  |  1990-10-14  |  878b  |  36 lines

  1.                                         /* Chapter 8 - Program 3 */
  2. main()
  3. {
  4. int pecans,apples;
  5.  
  6.    pecans = 100;
  7.    apples = 101;
  8.    printf("The starting values are %d %d\n",pecans,apples);
  9.  
  10.                            /* when we call "fixup"          */
  11.    fixup(pecans,&apples);  /* we take the value of pecans   */
  12.                            /* we take the address of apples */
  13.  
  14.    printf("The ending values are %d %d\n",pecans,apples);
  15. }
  16.  
  17. fixup(nuts,fruit)             /* nuts is an integer value   */
  18. int nuts,*fruit;              /* fruit points to an integer */
  19. {
  20.    printf("The values are %d %d\n",nuts,*fruit);
  21.    nuts = 135;
  22.    *fruit = 172;
  23.    printf("The values are %d %d\n",nuts,*fruit);
  24. }
  25.  
  26.  
  27.  
  28. /* Result of execution
  29.  
  30. The starting values are 100 101
  31. The values are 100 101
  32. The values are 135 172
  33. The ending values are 100 172
  34.  
  35. */
  36.